package org.bapoint.reactadmin.controller;

import lombok.extern.slf4j.Slf4j;
import org.bapoint.reactadmin.entity.TJobInstance;
import org.bapoint.reactadmin.entity.UserInfo;
import org.bapoint.reactadmin.entity.vo.PagnationParam;
import org.bapoint.reactadmin.mappers.JobInstanceMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName JobShduleInstanceController
 * @Description TODO
 * @Author wyp
 * @Date 2024/4/16 15:41
 * @Version 1.0
 */
@Slf4j
@Controller()
@RequestMapping(value = "/job")
public class JobShduleInstanceController extends RestBase{
    @Autowired
    private JobInstanceMapper mapper;


    @RequestMapping(value ="/list",method = RequestMethod.POST)
    @ResponseBody
    public Object getJobList(@RequestBody PagnationParam pagnationParam) {
        Integer offset = pagnationParam.getPageSize()* pagnationParam.getCurrent()- pagnationParam.getPageSize();
        List<TJobInstance> jobInstanceList = mapper.getJobInstanceByCondition(pagnationParam.getPageSize(),offset);
        Long total = mapper.countTotal();
        return ajaxSuccess(jobInstanceList,total);
    }
}
